Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

436
Vistas
Mqtt connection Failed- [ React native ]

I'm trying to connect and get the data from topic sent by sensor. Unfortunately the connection not working. in the console doesn't show no msg

Ps: I'm using react_native_mqtt lib and a port : 80

Any help is appreciated.

constructor(){
        super();
        this.onMessageArrived = this.onMessageArrived.bind(this)
        this.onConnectionLost = this.onConnectionLost.bind(this)
        this.onConnect = this.onConnect.bind(this)
        const client = new Paho.MQTT.Client(host, Number(port), clientID);
        client.onMessageArrived = this.onMessageArrived;
        client.onConnectionLost = this.onConnectionLost;
        client.connect({ 
          onSuccess: this.onConnect,
          useSSL: false,
          userName: "user",
          password: "pass",
          onFailure: this.onConnectionLost
    
        });
    
        this.state = {
          message: [''],
          client,
          messageToSend:'',
          isConnected: false,
        };
    
      }
      onConnect = () => {
        const { client } = this.state.client;
        console.log("Connected!!!!");
        client.subscribe(topic, () => {
          console.log('subscribe success topic1');
        });
        this.setState({isConnected: true, error: ''})
      };

After a few minute:

Android Running app on Android SDK built for x86
onConnectionLost:AMQJS0007E Socket error:undefined.
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda